## Drawing Fig8(e)
import matplotlib.pyplot as plt
from matplotlib import rcParams

plt.rcParams['figure.dpi'] = 1200
fr = open("DrawingFig8(e)(f).csv", "r")
ls = []
for line in fr:
    line = line.replace("\n","")
    ls.append(line.split(","))
fr.close()

x_start = -300.0
x_end = 5300.0
y_start = 0.0
y_end = 0.23
x1, x2, x3 = [], [], []
y1, y2, y3 = [], [], []
iLen, jLen = len(ls), len(ls[0])
for i in range(1, iLen):
    if int(ls[i][0]) == 10:
        x1.append(float(ls[i][1]))
        y1.append(float(ls[i][4]))
    elif int(ls[i][0]) == 20:
        x2.append(float(ls[i][1]))
        y2.append(float(ls[i][4]))
    elif int(ls[i][0]) == 30:
        x3.append(float(ls[i][1]))
        y3.append(float(ls[i][4]))

plt.figure(figsize=(6.0, 4.0))
plt.xlim(x_start-0.01, x_end+0.01)
plt.ylim(y_start-0.005, y_end+0.005)
plt.xticks([0, 1000, 2000, 3000, 4000, 5000], ['0', '1000', '2000', '3000', '4000', '5000'])
plt.plot(x1, y1, "r.-", label="$r = 10$", linewidth=1)
plt.plot(x2, y2, "g.-", label="$r = 20$", linewidth=1)
plt.plot(x3, y3, "b.-", label="$r = 30$", linewidth=1)
plt.xlabel('$L$')
plt.ylabel('$Std$')
plt.legend()

plt.savefig("Fig8(e).jpg")
plt.show()
